package van.planifolia.singleton;

/**
 * Created by Intellij IDEA<br>
 *
 * @author Planifolia.Van
 * @version 1.0
 * @date 2022/11/7 18:22
 */
public class LazyManV2 {
    /**
     * 首先还是声明一个对象引用
     */
    private static LazyManV2 lazyManV2;

    /**
     * 私有化构造方法
     */
    private LazyManV2() {
    }

    /**
     * 提供一个外接获取的
     *
     * @return 创建的bean对象
     */
    public static synchronized LazyManV2 getBean() {
        if (lazyManV2 == null) {
            synchronized (LazyManV2.class){
                if (lazyManV2 == null){
                    lazyManV2 = new LazyManV2();
                }
            }
        }
        return lazyManV2;
    }
}
